﻿using Microsoft.AspNetCore.Http;

namespace LJ.Host.Web.Thread;

public class CancellationTokenProvider(IHttpContextAccessor httpContextAccessor) : ICancellationTokenProvider
{

    /// <summary>
    /// 获取 异步任务取消标识
    /// </summary>
    public CancellationToken Token { get; } = httpContextAccessor.HttpContext?.RequestAborted ?? CancellationToken.None;
}